package com.wwj.auction.login.controller;

import com.wwj.auction.common.result.R;
import com.wwj.auction.login.entity.vo.SellerAuditVo;
import com.wwj.auction.login.service.SellerAuditService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 接收用户的审核信息
 *
 * @author wwj
 */
@RestController
@RequestMapping("/login/audit")
@Api("申请卖家")
public class SellerAuditController {

    @Autowired
    private SellerAuditService sellerAuditService;

    /**
     * 保存申请卖家的审核材料
     *
     * @return
     */
    @PostMapping("/seller/auth/save/{userId}")
    public R save(
            @RequestBody SellerAuditVo sellerAuditVo,
            @PathVariable("userId") Integer userId) {
        sellerAuditService.save(sellerAuditVo, userId);
        return R.ok();
    }

    /**
     * 获取卖家申请状态
     *
     * @param userId
     * @return
     */
    @GetMapping("/seller/get/status/{userId}")
    public R getStatus(@PathVariable("userId") Integer userId) {
        Integer status = sellerAuditService.getStatus(userId);
        return R.ok().data("status", status);
    }
}
